﻿<!--#include file="const.asp"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>


<%
if sid="Null" then
	Response.Redirect "login.asp"
	Response.end
end if
IF  Request.QueryString("Action")="login" Then
	call login
else
	call index
end if
end Function



Function index
	dim page,aid
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
	dim  rs2,sql2,Runtxt,classid,i
    		classid = Request("classid")
    		If classid = "" Then classid = 0
   		If Not IsNumeric(classid) Then classid = 0
    		classid = CLng(classid)
    		If classid < 0 Then classid = 0
    		aid = Request("aid")      '当前页数
    		If aid = "" Then aid = 1
   		If Not IsNumeric(aid) Then aid = 1
    		aid = CLng(aid)
	Runtxt=qingtian.RunStr


%>
	<card title="添加软件资源"><p align="left">
添加软件连接地址.
<br/>----------------<br/>
   	支持平台:<br/>
	<%
	  set rs2=server.CreateObject("adodb.recordset")
	  sql2="select id,name from qingtian_phonecha"
	  rs2.open sql2,conn,1,1
	  if not (rs2.bof and rs2.eof) then
	  For i=1 to rs2.RecordCount
		if i=1 then
		%>
		<select name="bid<%=Runtxt%>" multiple="true">
                <option value="0">支持所有平台</option>
		<%
		end if
		%>
		<option value="<%=rs2("id")%>"><%=qingtian.utf8(rs2("name"))%></option>
		<%
	  Rs2.MoveNext
	  Next
	else
	%>
		<select name="bid<%=Runtxt%>" value="0">
                <option value="0">支持所有平台</option>
	<%

	  end if
	  Rs2.close
	  set rs2=nothing
	%>
	</select><br/>
	软件地址:<br/>
	<input emptyok="true"  name="Fileurl<%=Runtxt%>"  value="" type="text"/><br/>
	软件格式:<br/>
	<input emptyok="true"  name="Fileext<%=Runtxt%>"  value="" type="text"/><br/>
	软件大小:<br/>
	<input emptyok="true"  name="Filesize<%=Runtxt%>"  value="" type="text"/><br/>
	<anchor>确定提交
    	<go href="addfilelist.asp?Action=login&amp;classid=<%=classid%>&amp;page=<%=page%>&amp;aid=<%=aid%>&amp;sid=<%=sid%>" method='post'>
        <postfield name="bid" value="$(bid<%=Runtxt%>)"/>
        <postfield name="Fileurl" value="$(Fileurl<%=Runtxt%>)"/>
        <postfield name="Fileext" value="$(Fileext<%=Runtxt%>)"/>
        <postfield name="Filesize" value="$(Filesize<%=Runtxt%>)"/>
    	</go>
	</anchor><br/>
-------------<br/>
<a href='filelist.asp?classid=<%=classid%>&amp;page=<%=page%>&amp;sid=<%=sid%>'>返回下载管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
End Function
Function login
	dim page,aid,i,rs2,sql2
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
	aid=Request.QueryString("aid")
	if aid="" then aid=1
	if not isnumeric(aid) then aid=1
	aid=clng(aid)
		dim rs,sql,errs,classid,fleg,Path,txtid
    		classid = Request("classid")
    		If classid = "" Then classid = 0
   		If Not IsNumeric(classid) Then classid = 0
    		classid = CLng(classid)
    		If classid < 0 Then classid = 0

		dim bid,fileurl,fileext,filesize
        bid=TRim(Request.form("bid"))
 	fileext=TRim(Request.Form("fileext"))
	filesize=TRim(Request.Form("filesize"))
	fileurl=TRim(Request.Form("fileurl"))
		errs=""
	if bid=""  then errs=errs&"平台分类不能为空<br/>"
	if fileurl=""  then errs=errs&"下载地址不能为空<br/>"
	if fileext=""  then errs=errs&"格式不能为空<br/>"
	if filesize=""  then errs=errs&"大小不能为空<br/>"
	%>
	<card id="login" title="添加软件资源"><p align="left">
	<%
	IF len(errs)=0 then
                If InStr(bid,";") <= 0 Then
		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select *  FROM qingtian_phoneurl"
		rs.open sql,conn,1,3
		rs.addnew()
			rs("aid")=aid
			rs("bid")=clng(bid)
			rs("fileext")=fileext
			rs("filesize")=filesize
			rs("fileurl")=fileurl
		rs.update()
		rs.Close
		Set rs = Nothing
                else
                bid=Split(bid,";")
                for i=0 to ubound(bid) 
                set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select *  FROM qingtian_phoneurl"
		rs.open sql,conn,1,3
		rs.addnew()
			rs("aid")=aid
			rs("bid")=clng(bid(i))
			rs("fileext")=fileext
			rs("filesize")=filesize
			rs("fileurl")=fileurl
		rs.update()
		rs.Close
		Set rs = Nothing
                next
                end if
		%>添加软件连接地址成功.<br/>----------------<br/>
   	支持平台:<br/>
	<%
	  set rs2=server.CreateObject("adodb.recordset")
	  sql2="select id,name from qingtian_phonecha"
	  rs2.open sql2,conn,1,1
	  if not (rs2.bof and rs2.eof) then
          i=1
	  For i=1 to rs2.RecordCount
		if i=1 then
		%>
		<select name="bid" multiple="true">
                <option value="0">支持所有平台</option>
		<%
		end if
		%>
		<option value="<%=rs2("id")%>"><%=qingtian.utf8(rs2("name"))%></option>
		<%
	  Rs2.MoveNext
	  Next
	else
	%>
		<select name="bid" value="0">
                <option value="0">支持所有平台</option>
	<%

	  end if
	  Rs2.close
	  set rs2=nothing
	%>
	</select><br/>
	软件地址:<br/>
	<input emptyok="true"  name="Fileurl"  value="<%=Fileurl%>" type="text"/><br/>
	软件格式:<br/>
	<input emptyok="true"  name="Fileext"  value="<%=Fileext%>" type="text"/><br/>
	软件大小:<br/>
	<input emptyok="true"  name="Filesize"  value="<%=Filesize%>" type="text"/><br/>
	<anchor>继续添加
    	<go href="addfilelist.asp?Action=login&amp;classid=<%=classid%>&amp;page=<%=page%>&amp;aid=<%=aid%>&amp;sid=<%=sid%>" method='post'>
        <postfield name="bid" value="$(bid)"/>
        <postfield name="Fileurl" value="$(Fileurl)"/>
        <postfield name="Fileext" value="$(Fileext)"/>
        <postfield name="Filesize" value="$(Filesize)"/>
    	</go>
	</anchor><br/>
<%

	else%>
		<%=errs%>
		<a href="addfilelist.asp?classid=<%=classid%>&amp;page=<%=page%>&amp;aid=<%=aid%>&amp;sid=<%=sid%>">返回修改</a><br/>
<%	end if
%>
<a href='addfilelist1.asp?aid=<%=aid%>&amp;classid=<%=classid%>&amp;page=<%=page%>&amp;sid=<%=sid%>'>返回文件上传</a><br/>
<a href='filelist.asp?classid=<%=classid%>&amp;page=<%=page%>&amp;sid=<%=sid%>'>返回下载管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
end Function 


%>
